package com.project.template.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.Getter;
import lombok.Setter;

import java.time.LocalDateTime;
import java.util.Date;

@Getter
@Setter
@Data
@TableName("user")
@ApiModel(value = "User", description = "会员信息表")
public class User {
    @Setter
    @Getter
    @TableId(type = IdType.AUTO)
    private Integer id;
    @ApiModelProperty("用户名")
    @TableField("username")
    private String username;
    @ApiModelProperty("密码")

    private String password;
    @ApiModelProperty("头像")
    private String avatar;
    @ApiModelProperty("电话")
    private String phone;
    @ApiModelProperty("性别")
    private String sex;// 0: 女, 1: 男
    @ApiModelProperty("生日")
    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date birth;
    @ApiModelProperty("地址")
    private String address;
    @ApiModelProperty("创建时间")

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createTime;

    @ApiModelProperty("角色类型")
    private String roleType;

    @ApiModelProperty("状态 启用/禁用")
    @TableField("status")
    private Integer status;

    public User(Integer id, String username, String password) {
        this.id = id;
        this.username = username;
        this.password = password;
    }

    public User() {

    }


    /**
     * 加密密码
     * @param password
     */


    public void encryptedPassword(String password) {
    }

    public Object sex() {
        return null;
    }

    public String getNewPassword() {
        return null;
    }
}